package com.godyao.mall.common.utils;

import com.godyao.mall.common.exception.ServerException;
import com.godyao.mall.core.model.ResultCode;

/**
 * @author godyao
 * @date 2022/4/3
 */
public class AssertUtils {

    public static void assertTrue(boolean flag) {
        if (!flag) throw new ServerException(ResultCode.SERVICE_EXCEPTION);
    }

    public static void assertTrue(boolean flag, ResultCode resultCode) {
        if (!flag) throw new ServerException(resultCode);
    }

    public static void assertTrue(boolean flag,Integer code,String msg){
        if (!flag) throw new ServerException(code,msg);
    }
}
